home *** CD-ROM | disk | FTP | other *** search
- Path: news.chattanooga.net!usenet
- From: "Eric W. Bradway" <ebradway@microsports.com>
- Newsgroups: comp.lang.c
- Subject: Re: What's wrong here?
- Date: Wed, 31 Jan 1996 13:33:35 -0500
- Organization: Micro Sports, Inc.
- Message-ID: <310FB5FF.4BE6@microsports.com>
- References: <4eml5o$o6h@airdmhor.gen.nz>
- NNTP-Posting-Host: 205.244.28.38
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b5 (Win95; I)
-
- Simon Hosie wrote:
- > Watcom gives the following warnings (and _only_ those warnings) compiling
- > the above code (except without the line numbers or colons), but only when
- > it's compiling it as C++ and generating 32 bit code (GCC doesn't, no matter
- > how hard I try). I don't know C++ myself, but my flatmate is learning it,
- > does it have anything to do with the typedef?
- >
- > TEST.CPP(12): Warning! W389: (col 15) integral value may be truncated during
- > assignment or initialization
- > TEST.CPP(17): Warning! W389: (col 15) integral value may be truncated during
- > assignment or initialization
-
- The typedef doesn't matter. Try turning off the optimizer (-od). Lines
- 12 is where a, b, c are first used and the uncasted numeric constants
- are being resolved. Again, at line 17, d is being access (not
- assigned?!?) for the first time.
-
- You may be able to clear everything up by changing lines 9-11 to:
- a = (word) 1;
- b = (word) 2;
- c = (word) 3;
-
- In my experience, WATCOM gives more warnings about this sort of thing
- than any other C/C++ compiler I've worked with. It also defaults to full
- optimizations which can have strange effects on your code (usually not
- your warnings however).
-
- -Eric
-